public class Solution1662 {
    public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
        StringBuilder a1= new StringBuilder();
        StringBuilder a2= new StringBuilder();
        for (String s : word1) {
            a1.append(s);
        }
        for (String s : word2) {
            a2.append(s);
        }
        return a1.toString().equals(a2.toString());
    }

    public static void main(String[] args) {
        System.out.println(new Solution1662().arrayStringsAreEqual(new String[]{"ab", "c"},new String[]{"a", "bc"}));
    }
}
